package com.itheima.String;

import java.util.Scanner;

public class Array {
    public static void main(String[] args) {  //直接对字符串进行遍历
       Scanner sc = new Scanner(System.in);
        System.out.println("请输入:");
        String s = sc.nextLine();
        for(int i = 0; i < s.length(); i++){
            char c = s.charAt(i);
            System.out.println(c);
        }

        System.out.println("-------------");//先转换为字符数组在进行遍历
        System.out.println("亲输入1:");
        String ss = sc.nextLine();
        char[] chars = ss.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            System.out.println(chars[i]);
        }

    }
}
